package com.funfei.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;
@Entity  
/*@NamedQueries( {  
    @NamedQuery( name="UserDao.findByUser", query = "SELECT u FROM user u where u.fullName = 'zhangsan'" ),  
    //@NamedQuery( name="User.classisQuery", query = "SELECT u FROM user u where u.fullName = :fullName" )  
})  */
public class User implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1073197021728088176L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)//主键自增，注意，这种方式依赖于具体的数据库，如果数据库不支持自增主键，那么这个类型是没法用的 
	private long id;
	
	@NotEmpty(message="用户名不能为空")
	@Column(nullable=false)
	private String username;
	
	@NotEmpty()
	@Size(max=16, min=3,message="密码长度应在3-16之间")
	@Column(nullable=false)
	private String password;
	
	@Column
	@Size(max=255)
	private String address;
	
	@Column
	private Date birthDay;
	
	@Column
	@Size(max=30)
	private String fullName;
 
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Date getBirthDay() {
		return birthDay;
	}

	public void setBirthDay(Date birthDay) {
		this.birthDay = birthDay;
	}

 

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

 

}
